<style type="text/css">
	.image-result-content {
		max-height: 50px;
		overflow: hidden;
		margin-bottom: 5px;
	}
	#image-result,
	#logo-result {
		max-height: 50px;
	}
	.input-group {
		margin-bottom: 8px;
	}
	.upload-group {
		padding-left: 90px;
	}
</style>
<form action="" class="form-horizontal" role="form">

	<div class="form-group">
		<label class="col-sm-2 control-label">一等奖</label>
		<div class="col-sm-4">
			<div class="input-group">
				<span class="input-group-addon">奖品名称</span>
				<input type="text" name="prize[0][name]" class="form-control" value="{$item['prize'][0]['name']}" placeholder="一等奖奖品名称" datatype="*">
			</div>
			<div class="input-group">
				<span class="input-group-addon">奖品数量</span>
				<input type="number" name="prize[0][total]" class="form-control" value="{$item['prize'][0]['total']}" placeholder="一等奖奖品数量" datatype="n">
			</div>
			<div class="input-group">
                <span class="input-group-addon">中奖机率</span>
                <input type="number" name="prize[0][percent]" class="form-control" value="{$item['prize'][0]['percent']}" placeholder="一等奖中奖机率" datatype="n">
                <span class="input-group-addon">%</span>
            </div>
			<div class="input-group">
				<span class="input-group-addon">奖品图片</span>
				<input type="text" name="prize[0][pic]" id="prize_pic_1" class="form-control" value="{$item['prize'][0]['pic']}" placeholder="一等奖奖品图片" datatype="*">
			</div>
			<div class="input-group upload-group">
				<input type="file" name="logo_upload_1" id="logo_upload_1" />
			</div>
			<div class="input-group">
                <span class="input-group-addon">红包序列码</span>
                <textarea class="form-control" name="prize[0][code]" rows="3">{$item['prize'][0]['code']}</textarea>
                <span class="label label-info">当奖品为商城红包时，把红包序列码输入此处，多条之间使用英文逗号(,)分隔。</span>
                <br />
                <span class="label label-danger">注意：红包序列码的数量和奖品的数量要一致，一旦活动开始，红包序列码及顺序不能修改。</span>
            </div>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">二等奖</label>
		<div class="col-sm-4">
			<div class="input-group">
				<span class="input-group-addon">奖品名称</span>
				<input type="text" name="prize[1][name]" class="form-control" value="{$item['prize'][1]['name']}" placeholder="二等奖奖品名称">
			</div>
			<div class="input-group">
				<span class="input-group-addon">奖品数量</span>
				<input type="number" name="prize[1][total]" class="form-control" value="{$item['prize'][1]['total']}" placeholder="二等奖奖品数量">
			</div>
			<div class="input-group">
                <span class="input-group-addon">中奖机率</span>
                <input type="number" name="prize[1][percent]" class="form-control" value="{$item['prize'][1]['percent']}" placeholder="二等奖中奖机率">
                <span class="input-group-addon">%</span>
            </div>
			<div class="input-group">
				<span class="input-group-addon">奖品图片</span>
				<input type="text" name="prize[1][pic]" id="prize_pic_2" class="form-control" value="{$item['prize'][1]['pic']}" placeholder="二等奖奖品图片">
			</div>
			<div class="input-group upload-group">
				<input type="file" name="logo_upload_2" id="logo_upload_2" />
			</div>
			<div class="input-group">
                <span class="input-group-addon">红包序列码</span>
                <textarea class="form-control" name="prize[1][code]" rows="3">{$item['prize'][1]['code']}</textarea>
                <span class="label label-info">当奖品为商城红包时，把红包序列码输入此处，多条之间使用英文逗号(,)分隔。</span>
                <br />
                <span class="label label-danger">注意：红包序列码的数量和奖品的数量要一致，一旦活动开始，红包序列码及顺序不能修改。</span>
            </div>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">三等奖</label>
		<div class="col-sm-4">
			<div class="input-group">
				<span class="input-group-addon">奖品名称</span>
				<input type="text" name="prize[2][name]" class="form-control" value="{$item['prize'][2]['name']}" placeholder="三等奖奖品名称">
			</div>
			<div class="input-group">
				<span class="input-group-addon">奖品数量</span>
				<input type="number" name="prize[2][total]" class="form-control" value="{$item['prize'][2]['total']}" placeholder="三等奖奖品数量">
			</div>
			<div class="input-group">
                <span class="input-group-addon">中奖机率</span>
                <input type="number" name="prize[2][percent]" class="form-control" value="{$item['prize'][2]['percent']}" placeholder="三等奖中奖机率">
                <span class="input-group-addon">%</span>
            </div>
			<div class="input-group">
				<span class="input-group-addon">奖品图片</span>
				<input type="text" name="prize[2][pic]" id="prize_pic_3" class="form-control" value="{$item['prize'][2]['pic']}" placeholder="三等奖奖品图片">
			</div>
			<div class="input-group upload-group">
				<input type="file" name="logo_upload_3" id="logo_upload_3" />
			</div>
			<div class="input-group">
                <span class="input-group-addon">红包序列码</span>
                <textarea class="form-control" name="prize[2][code]" rows="3">{$item['prize'][2]['code']}</textarea>
                <span class="label label-info">当奖品为商城红包时，把红包序列码输入此处，多条之间使用英文逗号(,)分隔。</span>
                <br />
                <span class="label label-danger">注意：红包序列码的数量和奖品的数量要一致，一旦活动开始，红包序列码及顺序不能修改。</span>
            </div>
		</div>
	</div>

	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-8">
			<input type="hidden" name="id" value="{$item.id}" /> <a class="btn btn-default" onclick="javascript:history.go(-1)">返回上页</a>
			<a class="btn btn-default" onclick="self.location=document.referrer">返回上页并刷新</a>
			<button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/savePrize">保存更改</button>
		</div>
	</div>

</form>


<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}"></script>
<script type="text/javascript">
	$(function() {
		$("#logo_upload_1").uploadify({
			'multi': false,
			'fileSizeLimit': '200kb',
			'buttonText': '选择图片',
			'fileTypeDesc': 'Image Files',
			'fileTypeExts': '*.jpg; *.png',
			'swf': '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
			'uploader': '__MODULE__/Upload/uploadOne',
			'onUploadSuccess': function(data, res) {

				var url = eval("(" + res + ")").extra.url;
				$("#prize_pic_1").val(url);

			}
		});

		$("#logo_upload_2").uploadify({
			'multi': false,
			'fileSizeLimit': '200kb',
			'buttonText': '选择图片',
			'fileTypeDesc': 'Image Files',
			'fileTypeExts': '*.jpg; *.png',
			'swf': '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
			'uploader': '__MODULE__/Upload/uploadOne',
			'onUploadSuccess': function(data, res) {

				var url = eval("(" + res + ")").extra.url;
				$("#prize_pic_2").val(url);

			}
		});

		$("#logo_upload_3").uploadify({
			'multi': false,
			'fileSizeLimit': '200kb',
			'buttonText': '选择图片',
			'fileTypeDesc': 'Image Files',
			'fileTypeExts': '*.jpg; *.png',
			'swf': '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
			'uploader': '__MODULE__/Upload/uploadOne',
			'onUploadSuccess': function(data, res) {

				var url = eval("(" + res + ")").extra.url;
				$("#prize_pic_3").val(url);

			}
		});

	});
</script>